<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改文章栏目')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-column-add" th:object="${info}">
            <input id="noticeId" name="columnId" th:field="*{columnId}"  type="hidden">
            <div class="form-group">	
                <label class="col-sm-2 control-label">栏目名称：</label>
                <div class="col-sm-10">
                    <input id="columnName"  th:field="*{columnName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">排序码：</label>
                <div class="col-sm-10">
                    <input id="sort"  th:field="*{sort}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">备注：</label>
                <div class="col-sm-10">
                    <textarea  th:field="*{remarks}" maxlength="500" class="form-control" rows="3"></textarea>
                </div>
            </div>
		</form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = "/sys/column";
        $("#form-column-add").validate({
            onkeyup: false,
            rules: {
                columnName: {
                    remote: {
                        url: prefix + "/checkColumnNameUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                            "columnName": function() {
                                return $.common.trim($("#columnName").val());
                            }
                        },
                        dataFilter: function(data, type) {
                            return $.validate.unique(data);
                        }
                    }
                },
            },
            messages: {
                "columnName": {
                    remote: "栏目名称已经存在"
                }
            },
            focusCleanup: true
        });
		function submitHandler() {
	        if ($.validate.form()) {
				$.operate.save(prefix + "/saveOrUpdate", $('#form-column-add').serialize());
	        }
	    }
	</script>
</body>
</html>
